package utils;

import com.squareup.okhttp.Call;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

import java.io.IOException;


/**
 * 工具类：获取数据
 */
public class GetResponse {

	static OkHttpClient client = new OkHttpClient();

	// 请求网络数据
	public static String request(String url) throws IOException {

		Request request = new Request.Builder().url(url).build();
		Call call = client.newCall(request);
		Response response = call.execute();
		String result = response.body().string();

		return result;
	}
}
